<?php
/**
 * Created by PhpStorm.
 * User: peter
 * Date: 2018/6/20
 * Time: 下午6:47
 */

namespace app\model;


class Address extends Base
{
    protected $pk = 'id';

    protected $json = ['province', 'city', 'county', 'town'];
    // 此处表名请务必设置为public
    public $table = 'address';

    /**
     * @purpose 根据条件获取数据条数
     * @param array $where
     * @return int
     */
    public function total(array $where = []): int
    {
        return (int) $this
            ->where($where)
            ->count();
    }
}